<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<style type="text/css">
.backcolor{
background-color: #5cacee;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<jsp:include page="../header.jsp"></jsp:include>
<title>用户信息</title>
</head>
<body>
<div class="contextBox">
<form name="form" action="<%=request.getContextPath()%>/riskManage/getrisklisthvaepay.do?currentPage=1" method="post">
		<table class="TableList" width="100%" align="center">
		   <tbody><tr class="TableContent">
		   <td >
		          用户姓名：<input type="text"  class="BigInput" id="userName" name="userName"  value="${userName}">
		         用户身份证：<input type="text" id="usercardNo" name="usercardNo"  value="${usercardNo}">
		         用户手机号：<input type="text" id="userPhone" name="userPhone"  value="${userPhone}">
		    </td>
		     </tr>
		</tbody></table>
		
		<div>
		<table>
		<tbody>
		<tr>
		<td>
		<input type="submit" value="搜索"/>
		<input type="button"   onclick="clearData()" value="清空"/>
		</td>
		</tr>
		</tbody>
		</table>
		</div>
		<table id="userinfotable" class="table" width="100%" align="center" border="0" cellspacing="0" cellpadding="0" class="list_table">
	    <tbody>
	    <tr>
	    <th width="1%" class="list_title" align="center"><input type="checkbox" name="allbox" id="allbox_for_requ"></th>
		<th width="7%" class="list_title" align="center"><b>案件编号</b></th>
		<th width="10%" class="list_title" align="center"><b>客户姓名</b></th>
		<th width="5%" class="list_title" align="center"><b>客户编号</b></th>
		<th width="14%" class="list_title" align="center"><b>客户身份证号</b></th>
		<th width="8%" class="list_title" align="center"><b>客户电话</b></th>
		<th width="5%" class="list_title" align="center"><b>催收标签</b></th>
		<th width="7%" class="list_title" align="center"><b>逾期金额</b></th>
		<th width="7%" class="list_title" align="center"><b>逾期费用</b></th>
		<th width="7%" class="list_title" align="center"><b>已还总额</b></th>
		<th width="8%" class="list_title" align="center"><b>委案日期</b></th>
	    <th width="8%" class="list_title" align="center"><b>上次操作时间</b></th>
		</tr>
		<c:forEach items="${datalist}" var="ui">		
		<tr>
		<td class="list_value" align="center">
		&nbsp;<input type="checkbox" name="requ_select" id="requ_checkbox_${ui.id}" value="${ui.id}">
		</td>
	    <td  align="left"><span>${ui.orderCode}</span></td>
	    <td  align="right"><span>${ui.userName }</span></td>
		<td  align="right"><span>${ui.userCode }</span></td>
		<td  align="center"><span>${ui.usercardNo }</span></td>
		<td  align="center"><span>${ui.userPhone }</span></td>
		<td  align="center"><span style="color: green">${ui.hkstatu }</span></td>
		<td  align="center"><span>${ui.yqAmount }</span></td>
		<td  align="center"><span>${ui.yqcostAmount }</span></td>
		<td  align="center"><span>${ui.dqpayAmount }</span></td>
		<td  align="right"><span>${ui.setTime }</span></td>
		<td  align="right"><span>${ui.opreateTime }</span></td>
		
	</tr>
	</c:forEach>
	
	</tbody>
	</table>
	
	<table>
		<tbody>
		<tr>
		<td>
	    <input type="hidden" name="currentPage" value="${currentPage}" /> 
			<input type="hidden" name="pageCount" value="${pageCount}"/> 
			<input type="hidden" name="count" value="${count}"/>
			<input type="button" name="first1" value="首页" onclick="first()" class="button gray" /> 
			<input type="button" name="pre1" value="上一页" onclick="pre()" class="button green"/> 
			<input type="button" name="next1" value="下一页" onclick="next()" class="button blue"/> 
			<input type="button" name="end1" value="尾页" onclick="end()" class="button gray"/> 
			<font>第${currentPage}页, 共${pageCount}页,共${count}条数据</font>
		</td>
		</tr>
		</tbody>
		</table>
		
		<table>
		<tbody>
		<tr>
		<td>
		<input type="text" name="start_time" id="start_time" size="20"
		value=""  class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"> -<input type="text" name="end_time" id="end_time" size="20"
		value=""  class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
		size="10" maxlength="10"> 共回款<input type="text" id="totalmoney" name="totalmoney"/>元<input type="button"   onclick="gettotalMoney()" value="统计"/>
		</td>
		</tr>
		</tbody>
		</table>
		
		
	</form>	
</div>
<script type="text/javascript">
$(function(){
	//全选
	  $("#allbox_for_requ").click(function(){
	    	if(this.checked){
	    	$("input[name='requ_select']").prop("checked",true);
	    	}else{
	    		$("input[name='requ_select']").prop("checked",false);
	    	}
	    });
	    
	    $("input[name='requ_select']").click(function(){
	    	var chkAllNum=$("input[name='requ_select']").size(); //选项总个数
	    	var chkSelectNum=0;
	    	$("input[name='requ_select']").each(function(i){
	    		if($(this).prop("checked")==true){
	    			chkSelectNum++;
	    		}
	    	});
	    	if(chkAllNum==chkSelectNum){
	    		//全选
	    		$("#allbox_for_requ").prop("checked",true);
	    	}else{
	    		//非全选
	    		$("#allbox_for_requ").prop("checked",false);
	    	}
	    });
	    
	   
});	





$(function(){init();Test();});
	function init() {
		var page = parseInt(document.form.currentPage.value);
		var pageCount = parseInt(document.form.pageCount.value);
		var count=parseInt(document.form.count.value);
		if (page == 1 && pageCount!=1) {
			document.form.pre1.disabled = "disabled";
			return;
		}
		if (page == count && pageCount!=1) {
			document.form.next1.disabled = "disabled";
			return;
		}
		if (pageCount == 1) {
			document.form.pre1.disabled = "disabled";
			document.form.next1.disabled = "disabled";
			document.form.first1.disabled = "disabled";
			document.form.end1.disabled = "disabled";
			return;
		}
	} 

	function first() {
		window.location.href = "<%=request.getContextPath()%>/riskManage/getrisklisthvaepay.do?currentPage=1"+getQueryData();
		
	}

	function next() {
		var page = parseInt(document.form.currentPage.value);
		window.location.href = "<%=request.getContextPath()%>/riskManage/getrisklisthvaepay.do?currentPage="
				+ (page + 1)+getQueryData();
	}

	function pre() {
		var page = parseInt(document.form.currentPage.value);
		window.location.href = "<%=request.getContextPath()%>/riskManage/getrisklisthvaepay.do?currentPage="
				+ (page - 1)+getQueryData();
	}

	function end() {
		var pageCount = parseInt(document.form.pageCount.value);
		window.location.href = "<%=request.getContextPath()%>/riskManage/getrisklisthvaepay.do?currentPage="
				+ pageCount+getQueryData();
	}
	//清除筛选条件
	function clearData(){
		$("#userName").val("");
		$("#usercardNo").val("");
		$("#userPhone").val("");}
	
	//拼接查询条件
	function getQueryData(){
		var userName=$("#userName").val();
		var usercardNo=$("#usercardNo").val();
		var userPhone=$("#userPhone").val();
		var queryper="&userName="+userName+"&usercardNo="+usercardNo+"&userPhone="+userPhone; 
		return queryper;
		}
	//当指针放到行上触发事件并加深背景色
	 function Test(){  
		 var rows=document.getElementById("userinfotable").rows;  
		   if(rows.length>0){  
	            for(var i=1;i<rows.length;i++){  
	                var obj=rows[i];  
	                obj.onmouseover=function(){
	                	$(this).addClass("backcolor").siblings("tr").removeClass("backcolor")
	                };
	                obj.onclick=function(){
	                	var orderno=$(this).children().eq(1).text();
	                	var userNumber=$(this).children().eq(4).text();
	                	var userPhone=$(this).children().eq(6).text();
	                	location.href="<%=request.getContextPath()%>/riskManage/getcollectioninfo.do?orderno="+orderno+"&userNumber="+userNumber+"&userPhone="+userPhone;
	                	location.reload;	
	               };  
	               
	            }  
	        }   
	    }  

	
	
	//统计回款
	function gettotalMoney(starttime,endtime){
		var start_time=$("#start_time").val();
		var end_time= $("#end_time").val();
		 $.ajax({
			   type: "post",
			   url: "<%=request.getContextPath()%>/riskManage/getTotalMoney.do",
			   data: {"start_time":start_time,"end_time":end_time},
			   success: function(data){
				 var obj = JSON.parse(data);
				 $("#totalmoney").val(obj.totalmoney);
			   }
			}); 
	}
	</script>
</body>
</html>